<template>
	<view class="container">
		<view class="header">
			<view class="top flexCenter">
				<image
					:src="defaultAvatar"
					mode=""
				></image>
				<view class="right">
					<view class="username">
						{{ userinfo.nickname }}
					</view>
					<view class="phone">
						{{ userinfo.username }}
					</view>
				</view>
			</view>
			<view class="bottom flexBetween">
				<view class="left flexCenter">
					<image
						src="@/static/images/mine/money.png"
						mode=""
					></image>
					<view class="center">
						<view class="num">
							{{userinfo.yongjin}}
						</view>
						<view class="info">
							可提现金额(元)
						</view>
					</view>
				</view>
				<view
					class="button"
					@tap="getCash"
				>立即提现</view>
			</view>
		</view>
		<view class="list">
		<!-- 	<view
				class="item flexBetween"
				@tap="go('info')"
			>
				<view class="left flexCenter">
					<image
						src="@/static/images/mine/user.png"
						mode=""
					></image>
					个人资料
				</view>
				<image
					class="right"
					src="@/static/images/icon/right.png"
					mode=""
				></image>
			</view> -->
			<view
				class="item flexBetween"
				@tap="go('password')"
			>
				<view class="left flexCenter">
					<image
						src="@/static/images/mine/password.png"
						mode=""
					></image>
					修改密码
				</view>
				<image
					class="right"
					src="@/static/images/icon/right.png"
					mode=""
				></image>
			</view>
			<!-- <view
				class="item flexBetween"
				@tap="go('notebook')"
			>
				<view class="left flexCenter">
					<image
						src="@/static/images/mine/use.png"
						mode=""
					></image>
					使用手册
				</view>
				<image
					class="right"
					src="@/static/images/icon/right.png"
					mode=""
				></image>
			</view> -->
			<!-- <view
				class="item flexBetween"
				@tap="go('answer')"
			>
				<view class="left flexCenter">
					<image
						src="@/static/images/mine/question.png"
						mode=""
					></image>
					疑难问题解答
				</view>
				<image
					class="right"
					src="@/static/images/icon/right.png"
					mode=""
				></image>
			</view> -->
			<view
				class="item flexBetween"
				@tap="go('feedback')"
			>
				<view class="left flexCenter">
					<image
						src="@/static/images/mine/back.png"
						mode=""
					></image>
					功能反馈
				</view>
				<image
					class="right"
					src="@/static/images/icon/right.png"
					mode=""
				></image>
			</view>
			<view
				class="item flexBetween"
				@tap="logout"
			>
				<view class="left flexCenter">
					<image
						src="@/static/images/mine/exit.png"
						mode=""
					></image>
					退出登录
				</view>
				<image
					class="right"
					src="@/static/images/icon/right.png"
					mode=""
				></image>
			</view>
		</view>
	</view>
</template>
<script>
import defaultAvatar from '@/static/images/mine/mine.png'
import { Home } from '@/config/API.js'
import { logout, goPage } from '@/utils/uni.js'
export default {
	data () {
		return {
			defaultAvatar,
			userinfo: {}
		}
	},
	onShow () {
		this.getUserInfo()
	},
	methods: {
		logout,
		goPage,
		getUserInfo () {
			Home.userCenter().then(res => {
				this.userinfo = res.data
			})
		},
		go (next) {
			uni.navigateTo({
				url: `/pages/mine/${next}/${next}`
			})
		},
		getCash () {
			uni.navigateTo({
				url: "/pages/center/getCash/getCash"
			})
		}
	}
}
</script>

<style lang="scss" scoped>
.container {
	padding: 37rpx 32rpx 0;
}

.header {
	.top {
		margin-bottom: 40rpx;

		image {
			width: 138rpx;
			height: 138rpx;
			margin-right: 18rpx;
			border-radius: 50%;
		}

		.right {
			.username {
				font-size: 36rpx;
				font-family: PingFang SC-Heavy, PingFang SC;
				font-weight: 800;
				color: #1a1a1a;
			}

			.phone {
				font-size: 24rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #999999;
			}
		}
	}

	.bottom {
		width: 685rpx;
		height: 140rpx;
		background: #f7f8fa;
		border-radius: 20rpx 20rpx 20rpx 20rpx;
		opacity: 1;
		padding: 19rpx 32rpx 25rpx 24rpx;
		margin-bottom: 37rpx;

		.left {
			image {
				width: 65rpx;
				height: 85rpx;
				margin-right: 19rpx;
			}

			.center {
				.num {
					font-size: 48rpx;
					font-family: DIN-Bold-, DIN-Bold;
					font-weight: bold;
					color: #1a1a1a;
				}

				.info {
					font-size: 24rpx;
					font-family: PingFang SC-Medium, PingFang SC;
					font-weight: 500;
					color: #999999;
				}
			}
		}

		.button {
			width: 140rpx;
			height: 52rpx;
			line-height: 52rpx;
			text-align: center;
			background: linear-gradient(270deg, #ff0000 0%, #fe5454 100%);
			border-radius: 25rpx 25rpx 25rpx 25rpx;
			opacity: 1;

			font-size: 24rpx;
			font-family: PingFang SC-Regular, PingFang SC;
			font-weight: 400;
			color: #ffffff;
		}
	}
}

.list {
	.item {
		box-sizing: content-box;
		padding: 33rpx 0;

		.left {
			font-size: 30rpx;
			font-family: PingFang SC-Bold, PingFang SC;
			font-weight: bold;
			color: #1a1a1a;

			image {
				width: 32rpx;
				height: 32rpx;
				margin-right: 19rpx;
			}
		}

		.right {
			width: 12rpx;
			height: 22rpx;
		}
	}
}
</style>